home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #9
/
Amiga Plus CD - 2004 - No. 09.iso
/
amigaplus
/
tools
/
amigaos4_only
/
ifxlite
/
imagefx3
/
rexx
/
motionreq.ifx
< prev
next >
Wrap
Text File
|
2004-08-03
|
18KB
|
1,007 lines
/*
* $VER: MotionReq 1.0.4 (12.10.94)
*
* Motion Requester for ImageFX 2.0 by Rusty Mills
*
* Portions of this program are NOT freely distributable without the
* permission of the author!
*
*/
SIGNAL ON HALT
/* SIGNAL ON ERROR */
OPTIONS RESULTS
Drawmode Normal
Dmode=result
Drawmode Dmode
RequestResponse "Load Previously Saved Settings?"
IF rc=0 THEN CALL loadset
ENDIF
rdbrsh:
GETBRUSH
/* IF result=0 THEN CALL ldbsh
ENDIF
*/
PARSE VAR result name width height .
stx=0
sty=0
fr=24
edx=0
edy=0
si=0
so=0
edz=width
stz=width
rtz=0
Svs=0
Ani=0
Rev=0
srtz=0
nbnm=""
Aniflg=0
MotReq:
SaveBrushAS ILBM "RAM:temp.bsh" FORCE
Gadget.1 = 'I/35/28/X:/'||stx
Gadget.2 = 'I/35/43/Y:/'||sty
Gadget.3 = 'I/110/28//'||edx
Gadget.4 = 'I/110/43//'||edy
Gadget.5 = 'L/355/28/2/0/Start Size:'||stz
Gadget.6 = 'I/385/43/End Size:/'||edz
Gadget.7 = 'I/155/74/Start Rotate Z:/'||srtz
Gadget.8 = 'I/155/89/Amount to Rotate Z:/'||rtz
Gadget.9 = 'I/380/74/# Frs. Ease-beg:/'||si
Gadget.10 = 'I/380/89/# Frs. Ease-end:/'||so
Gadget.11 = 'X/135/122/Animation/'||Ani
Gadget.12 = 'X/320/140/Save Settings/'||Svs
Gadget.13 = 'C/25/140//2/Preview/Render'
Gadget.14 = 'L/10/57/2/2/_________________________________________________________'
Gadget.15 = 'L/10/105/1/2/_________________________________________________________'
Gadget.16 = 'L/10/62/1/2/_________________________________________________________'
Gadget.17 = 'L/10/100/2/2/_________________________________________________________'
Gadget.18 = 'L/12/57/2/2/________________________________________________________'
Gadget.19 = 'L/12/105/1/2/________________________________________________________'
Gadget.20 = 'L/12/62/1/2/________________________________________________________'
Gadget.21 = 'L/12/100/2/2/________________________________________________________'
Gadget.22 = 'L/55/18/1/0/Start'
Gadget.23 = 'L/135/18/1/0/End'
Gadget.24 = 'F/25/122/Load Brush/Load Brush Image///'
Gadget.25 = 'C/202/28//9/None/UL const/LL const/UR const/LR const/UL sep/LL sep/UR sep/LR sep'
Gadget.26 = 'L/227/18/1/0/Shadow'
Gadget.27 = 'X/135/140/Create in Reverse/'||Rev
Gadget.28 = 'I/385/120/Total # of Frames:/'||fr
Gadget.29 = 'C/202/43//2/Hard Edge/Soft Edge'
ComplexRequest '"Motion Requester"' 29 Gadget 475 176
IF rc~=0 THEN EXIT
ENDIF
IF width=height THEN pers=width
ELSE pers=width/(width-height)
ENDIF
stx=Result.1
sty=Result.2
edx=Result.3
edy=Result.4
edz=Result.6
srtz=Result.7
rtz=Result.8
si=Result.9
so=Result.10
Ani=Result.11
Svs=Result.12
prv=Result.13
nbnm=Result.24
Shd=Result.25
Rev=Result.27
fr=Result.28
sed=Result.29
Message "Calculating Move"
IF nbnm="" THEN CALL cnton
ELSE CALL Lbrsh
ENDIF
cnton:
CALL DetLoad
LBctr=1
IF Ani=1 THEN CALL AniLoad
ENDIF
IF prv=0 THEN CALL Prep
ENDIF
IF Svs=1 THEN CALL Saveset
ENDIF
RequestFile '"Saving Images Base Name"'
IF rc~=0 THEN CALL MotReq
ENDIF
imnam=result
Prep:
IF rtz~=0 THEN CALL rotagl
ENDIF
ctr=1
XPL.=0
YPL.=0
ZPL.=0
IF stx>edx THEN ttx=stx-edx
ELSE ttx=edx-stx
ENDIF
IF sty>edy THEN tty=sty-edy
ELSE tty=edy-sty
ENDIF
IF stz>edz THEN ttz=stz-edz
ELSE ttz=edz-stz
ENDIF
IF ttx=0 THEN ttx=stx
ENDIF
IF tty=0 THEN tty=sty
ENDIF
IF ttz=0 THEN ttz=stz
ENDIF
IF ttx~=stx THEN CALL CalcX
ELSE DO i=1 TO fr-1
XPL.ctr=ttx
ctr=ctr+1
END
ENDIF
IF EXISTS('RAM:XCord.TXT')=1 THEN ADDRESS COMMAND 'C:Delete RAM:XCord.TXT'
ENDIF
IF tty~=sty THEN CALL CalcY
ELSE DO i=1 TO fr-1
YPL.ctr=tty
ctr=ctr+1
END
ENDIF
IF EXISTS('RAM:YCord.TXT')=1 THEN ADDRESS COMMAND 'C:Delete RAM:YCord.TXT'
ENDIF
IF ttz~=stz THEN CALL CalcZ
ELSE DO i=1 TO fr-1
ZPL.ctr=ttz
ctr=ctr+1
END
ENDIF
IF EXISTS('RAM:ZCord.TXT')=1 THEN ADDRESS COMMAND 'C:Delete RAM:ZCord.TXT'
ENDIF
SELECT
WHEN Shd=0 THEN NOP
WHEN Shd=1 THEN CALL ConstShd /* UL const */
WHEN Shd=2 THEN CALL ConstShd /* LL const */
WHEN Shd=3 THEN CALL ConstShd /* UR const */
WHEN Shd=4 THEN CALL ConstShd /* LR const */
WHEN Shd=5 THEN CALL SepShd /* UL sep */
WHEN Shd=6 THEN CALL SepShd /* LL sep */
WHEN Shd=7 THEN CALL SepShd /* UR sep */
WHEN Shd=8 THEN CALL SepShd /* LR sep */
END
IF prv=0 THEN CALL Preview
ELSE CALL Stamp
ENDIF
IF EXISTS('RAM:temp.bsh')=1 THEN ADDRESS COMMAND 'C:Delete RAM:temp.bsh'
ENDIF
IF EXISTS('RAM:temp.bsh.nail.info')=1 THEN ADDRESS COMMAND 'C:Delete RAM:temp.bsh.nail.info'
ENDIF
EXIT
CalcX:
CF="X"
IF stx<edx THEN sp=stx
ELSE sp=edx
ENDIF
A=ttx
CALL begslio
IF stx<edx THEN ctr=1
ELSE ctr=fr
ENDIF
DO i=1 TO fr
XPL.i=PL.ctr
IF stx<edx THEN ctr=ctr+1
ELSE ctr=ctr-1
ENDIF
END
RETURN
CalcY:
CF="Y"
IF sty<edy THEN sp=sty
ELSE sp=edy
ENDIF
A=tty
CALL begslio
IF sty<edy THEN ctr=1
ELSE ctr=fr
ENDIF
DO i=1 TO fr
YPL.i=PL.ctr
IF sty<edy THEN ctr=ctr+1
ELSE ctr=ctr-1
ENDIF
END
RETURN
CalcZ:
CF="Z"
IF stz<edz THEN sp=stz
ELSE sp=edz
ENDIF
A=ttz
CALL begslio
IF stz<edz THEN ctr=1
ELSE ctr=fr
ENDIF
DO i=1 TO fr
ZPL.i=PL.ctr
IF stz<edz THEN ctr=ctr+1
ELSE ctr=ctr-1
ENDIF
END
RETURN
Stamp:
IF srtz~=0 THEN DO
neg=SIGN(srtz)
IF neg=-1 THEN ROTATE '"'srtz
ELSE ROTATE srtz
ENDIF
END
ENDIF
SaveBrushAS ILBM "RAM:temp.bsh" FORCE
EdgeMode AntiAlias 0
ctr=1
IF Rev=0 THEN inum=1
ELSE inum=fr
ENDIF
LBctr=1
DO i=1 TO fr
message "Creating Frame "inum
IF Ani=1 THEN DO
CALL AniLoad
neg=SIGN(srtz)
IF neg=-1 THEN ROTATE '"'srtz
ELSE ROTATE srtz
ENDIF
END
ENDIFj
IF etz~=stz THEN CALL sclz
ENDIF
IF rtz~=0 THEN ROTATE angl.ctr
ENDIF
/* Hook "ImageFX2:Hooks/Sys/Rotate" 56 0 angl.ctr 0 1 46 30 0 0 0 0 1
*/
IF Shd>0 THEN DO
DrawMode ARGS 60
DrawMode Darken
NewArea
AddArea Shdx.ctr Shdy.ctr
AddArea Shdx.ctr Shdy.ctr
CALL ShdoEdg
FreeLine
EdgeMode AntiAlias 0
DrawMode Dmode
END
ENDIF
NewArea
AddArea XPL.ctr YPL.ctr
FreeLine
message "Saving Frame "inum
SavebufferAs ILBM imnam"."||RIGHT('00'||inum,3)
Undo
Undo
ctr=ctr+1
IF Rev=0 THEN inum=inum+1
ELSE inum=inum-1
ENDIF
END
EXIT
Preview:
IF Rev=1 THEN ctr=fr
ELSE ctr=1
ENDIF
DO i=1 TO fr
nws=ZPL.ctr-(ZPL.ctr/pers)
VirtualBox XPL.ctr YPL.ctr XPL.ctr+ZPL.ctr YPL.ctr+nws
VirtualBox XPL.ctr YPL.ctr XPL.ctr+ZPL.ctr YPL.ctr+nws
IF Rev=1 THEN ctr=ctr-1
ELSE ctr=ctr+1
ENDIF
END
CALL Motreq
sclz:
nwsy=ZPL.ctr-(ZPL.ctr/pers)
LoadBrush "RAM:temp.bsh"
Region Brush
Scale ZPL.ctr nwsy
RETURN
SaveSet:
IF prv=0 THEN RETURN
ENDIF
RequestFile '"Save Settings"' "S:" "Motion.stg"
IF rc~=0 THEN RETURN
ENDIF
sname=result
OPF=OPEN('stemp',sname,'W')
IF OPF~=1 THEN CALL sverr
ENDIF
WRITELN('stemp',name)
WRITELN('stemp',stx)
WRITELN('stemp',sty)
WRITELN('stemp',edx)
WRITELN('stemp',edy)
WRITELN('stemp',stz)
WRITELN('stemp',edz)
WRITELN('stemp',rtz)
WRITELN('stemp',fr)
WRITELN('stemp',si)
WRITELN('stemp',so)
WRITELN('stemp',Ani)
WRITELN('stemp',srtz)
WRITELN('stemp',Shd)
WRITELN('stemp',Rev)
CLOSE('stemp')
RETURN
sverr:
RequestNotify "Unable to save settings file"
CALL Prep
rotagl:
/*IF fr>rtz THEN agl=fr/rtz
ELSE agl=rtz/fr
ENDIF */
agl=rtz/(fr-1)
angl.=0
ctr=1
rang=0
DO i=1 TO fr
angl.ctr=rang
ctr=ctr+1
rang=rang+agl
END
RETURN
loadset:
RequestFile "Load"
IF rc~=0 THEN CALL rdbrsh
ENDIF
stnm=result
lbs=OPEN('lset',stnm,'R')
IF lbs=0 THEN CALL nogo
ENDIF
sets.=0
name=""
name=READLN('lset')
DO i=1 TO 14
sets.i=READLN('lset')
END
CLOSE('lset')
stx=sets.1
sty=sets.2
edx=sets.3
edy=sets.4
stz=sets.5
edz=sets.6
rtz=sets.7
fr=sets.8
si=sets.9
so=sets.10
Ani=sets.11
srtz=sets.12
Shd=sets.13
Rev=sets.14
LoadBrush name
GETBRUSH
PARSE VAR result name width height .
CALL MotReq
nogo:
RequestNotify "Can't Open File "name
CALL rdbrsh
Ldbsh:
LoadBrush
CALL rdbrsh
Lbrsh:
name=nbnm
LoadBrush name
GETBRUSH
PARSE VAR result name width height .
IF width=height THEN pers=width
ELSE pers=width/(width-height)
ENDIF
SaveBrushAS ILBM "RAM:temp.bsh" FORCE
CALL cnton
ConstShd:
Shdx.=0
Shdy.=0
SELECT
WHEN Shd=1 THEN DO i=1 to fr/* UL const */
Shdx.i=XPL.i-(XPL.i*0.10)
Shdy.i=YPL.i-(YPL.i*0.10)
END
WHEN Shd=2 THEN DO i=1 to fr/* LL const */
Shdx.i=XPL.i-(XPL.i*0.10)
Shdy.i=YPL.i+(YPL.i*0.10)
END
WHEN Shd=3 THEN DO i=1 to fr/* UR const */
Shdx.i=XPL.i+(XPL.i*0.10)
Shdy.i=YPL.i-(YPL.i*0.10)
END
WHEN Shd=4 THEN DO i=1 to fr/* LR const */
Shdx.i=XPL.i+(XPL.i*0.10)
Shdy.i=YPL.i+(YPL.i*0.10)
END
END
Return
SepShd:
Shdx.=0
Shdy.=0
CF="ShdX"
SELECT
WHEN Shd=5 THEN sp=XPL.1-(XPL.1*0.20)
WHEN Shd=6 THEN sp=XPL.1-(XPL.1*0.20)
WHEN Shd=7 THEN sp=XPL.1+(XPL.1*0.20)
WHEN Shd=8 THEN sp=XPL.1+(XPL.1*0.20)
END
A=ttx*2
CALL begslio
IF EXISTS('RAM:ShdXCord.TXT')=1 THEN ADDRESS COMMAND 'C:Delete RAM:ShdXCord.TXT'
ENDIF
CF="ShdY"
SELECT
WHEN Shd=5 THEN sp=YPL.1-(YPL.1*0.20)
WHEN Shd=6 THEN sp=YPL.1+(YPL.1*0.20)
WHEN Shd=7 THEN sp=YPL.1-(YPL.1*0.20)
WHEN Shd=8 THEN sp=YPL.1+(YPL.1*0.20)
END
A=tty*2
CALL begslio
IF EXISTS('RAM:ShdYCord.TXT')=1 THEN ADDRESS COMMAND 'C:Delete RAM:ShdYCord.TXT'
ENDIF
IF sty<edy THEN xctr=1
ELSE xctr=fr
ENDIF
IF stx<edx THEN yctr=1
ELSE yctr=fr
ENDIF
SELECT
WHEN Shd=5 THEN DO i=1 TO fr
Shdx.i=PL.xctr
Shdy.i=PL.yctr
IF sty<edy THEN yctr=yctr+1
ELSE yctr=yctr-1
ENDIF
IF stx<edx THEN xctr=xctr+1
ELSE xctr=xctr-1
ENDIF
END
WHEN Shd=6 THEN DO i=1 TO fr
Shdx.i=PL.xctr
Shdy.i=PL.yctr
IF sty<edy THEN yctr=yctr+1
ELSE yctr=yctr-1
ENDIF
IF stx<edx THEN xctr=xctr+1
ELSE xctr=xctr-1
ENDIF
END
WHEN Shd=7 THEN DO i=1 TO fr
Shdx.i=PL.xctr
Shdy.i=PL.yctr
IF sty<edy THEN yctr=yctr+1
ELSE yctr=yctr-1
ENDIF
IF stx<edx THEN xctr=xctr+1
ELSE xctr=xctr-1
ENDIF
END
WHEN Shd=8 THEN DO i=1 TO fr
Shdx.i=PL.xctr
Shdy.i=PL.yctr
IF sty<edy THEN yctr=yctr+1
ELSE yctr=yctr-1
ENDIF
IF stx<edx THEN xctr=xctr+1
ELSE xctr=xctr-1
ENDIF
END
END
Return
ShdoEdg:
IF sed=1 THEN EdgeMode FeatherIn 4
ENDIF
RETURN
DetLoad:
IF Ani=0 THEN Return
ENDIF
digi=0
con=1
t=2
DO WHILE con
IF RIGHT(name,t)>=0 THEN t=t+1
ELSE con=0
ENDIF
END
digi=t-2
IF digi=0 THEN RequestNotify 'Cannot determine frame extension.'
ENDIF
nl=LENGTH(name)-(t)
con=1
t=2
delname=DELSTR(name,1,1)
basename=LEFT(delname,nl)
nlist.=""
dgfl=0
ctr=1
DO i=1 TO fr
IF EXISTS(basename||RIGHT(i,digi,'0'))=1 THEN
nlist.i=basename||RIGHT(i,digi,'0')
ELSE dgfl=1
ENDIF
IF dgfl=1 THEN DO
hld=i-ctr
nlist.i=basename||RIGHT(hld,digi,'0')
ctr=ctr+1
END
ENDIF
END
Return
AniLoad:
LoadBrush nlist.LBctr
IF rc~=0 THEN CALL MotReq
ENDIF
GETBRUSH
PARSE VAR result name width height .
pers=width/(width-height)
SaveBrushAS ILBM "RAM:temp.bsh" FORCE
LBctr=LBctr+1
Aniflg=1
Return
ERROR:
IF RC=2001 THEN CALL nwbrsh
ELSE DO
RequestNotify "An Arexx Error Has Occured. Motion Requester Exiting"
IF EXISTS('RAM:temp.bsh')=1 THEN ADDRESS COMMAND 'C:Delete RAM:temp.bsh'
ENDIF
IF EXISTS('RAM:temp.bsh.nail.info')=1 THEN ADDRESS COMMAND 'C:Delete RAM:temp.bsh.nail.info'
ENDIF
EXIT
END
ENDIF
nwbrsh:
LoadBrush
IF rc~=0 THEN EXIT
ENDIF
CALL rdbrsh
HALT:
IF EXISTS('RAM:temp.bsh')=1 THEN ADDRESS COMMAND 'C:Delete RAM:temp.bsh'
ENDIF
IF EXISTS('RAM:temp.bsh.nail.info')=1 THEN ADDRESS COMMAND 'C:Delete RAM:temp.bsh.nail.info'
ENDIF
EXIT
/*--------------------Slowin&out.rexx (8-19-94)---------------------*/
/* */
/* This may be used within your program */
/* as long as this messgae is left intact. */
/* */
/* Arexx Program for slowin & out calculations */
/* */
/* Variables that must be passed to this program */
/* */
/* (example values) */
/* | */
/* V */
/* CF=X -- Coordinate we are processing */
/* sp=20 -- Value of Starting Point */
/* fr=70 -- Total # of Frames */
/* si=15 -- Total # of slowin Frames */
/* so=10 -- Total # of slowout Frames */
/* A=300 -- Total distance to move */
/* */
/* The program will return the following */
/* Variables that you may want to use. */
/* */
/* mess -- an error message string */
/* used if calculations cannot */
/* be completed. */
/* AdjMess. -- a compound variable with 4 */
/* strings that make up a */
/* message to be used in a */
/* Requester asking the user */
/* if the image can be scaled */
/* to compensate for a lack of pixels. */
/* sz -- percent to scale image if main */
/* program returns a 1 (yes) from the */
/* AdjMess. */
/* flg -- flag to indicate using AdjMess. 1= use it */
/* flga -- flag to alert textfile not opening */
/* flgb -- flag to alert for adjusting input */
/* PL. -- Compound variable containing the */
/* entire move (this is the one you want!) */
/* */
/* The program also outputs the contents of PL into a file */
/* in RAM that is named after the coordinate it represents. */
/* */
/* */
/* Written by Rusty Mills */
/* */
/*------------------------------------------------------------------*/
begslio:
flg=0
flga=0
flgb=0
percA=TRUNC((fr/si)+0.5)
percB=TRUNC((fr/so)+0.5)
R=TRUNC((A/percA)+0.5) /* Total distance for slowin */
U=TRUNC((A/percB)+0.5) /* Total distance for slowout */
IF A<fr THEN CALL moveadj
ENDIF
slowmain:
SMA=R+U
SMB=si+so
SMC=A-SMA
SMD=fr-SMB
SM=TRUNC((SMC/SMD)+0.5)
MT=fr-so
IF SM=0 THEN CALL err2
IF si=1 THEN CALL err
ENDIF
IF so=1 THEN CALL err
tn=1
Z=OPEN('temp'tn,'RAM:tempfile'tn,'W')
IF Z~=1 THEN EXIT
ENDIF
fv=0
AB=TRUNC((R/2)+0.5)
DO fv=fv to si
WRITELN('temp'tn,AB)
AB=TRUNC((AB/2)+0.5)
IF AB<0 THEN AB=0
ENDIF
IF AB>SM THEN AB=SM
ENDIF
END
ZF=CLOSE('temp'tn)
Line.=0
cnt=1
fx=1
ZA=OPEN('temp'tn,'RAM:tempfile'tn,'R')
IF ZA~=1 THEN EXIT
ENDIF
DO fx=fx to si
Line.cnt=READLN('temp'tn)
cnt=cnt+1
END
CLOSE('temp'tn)
prnt=2
fyz=1
tsi=Line.prnt
DO fyz=fyz to si
prnt=prnt+1
tsi=tsi + Line.prnt
END
EF=TRUNC((U/2)+0.5)
IF EF>SM THEN EF=SM
ENDIF
sline.=0
prnt=1
p=1
DO p=p to so
sline.prnt=EF
EF=TRUNC((EF/2)+0.5)
IF EF<0 THEN EF=0
ENDIF
IF EF>SM THEN EF=SM
ENDIF
prnt=prnt+1
END
prnt=2
fyz=1
tso=sline.prnt
DO fyz=fyz to so
prnt=prnt+1
tso=tso + sline.prnt
END
SMdis=A-(tsi+tso)
SM=SMdis/SMD
Comdis=(tsi+tso)+SMdis
IF Comdis>A THEN SM=SM-(A-Comdis)
ENDIF
FPX=sp
AB=TRUNC((R/2)+0.5)
CD=TRUNC((U/2)+0.5)
IF CD>SM THEN CD=SM
ENDIF
i=1
sb=0
c=1
PL.=0
pct=1
cnt=cnt-1
/* This the Creates the compound variable PL. that is returned and
the RAM outputfile. */
Z=OPEN('tp2','RAM:'CF'Cord.TXT','W')
IF Z~=1 THEN CALL err3
ENDIF
IF flga~=1 THEN WRITELN('tp2','*** Increment file for 'CF' coordinate ***')
IF flga~=1 THEN WRITELN('tp2',' ')
DO i=i to fr
PL.pct=FPX
IF flga~=1 THEN WRITELN('tp2','Frame.'i' 'FPX)
SELECT
WHEN c<=si THEN CALL slin
WHEN c>si THEN CALL decd
OTHERWISE NOP
END
c=c+1
pct=pct+1
END
IF flga~=1 THEN CLOSE('tp2')
ADDRESS COMMAND 'Delete'" RAM:tempfile"tn
tn=tn+1
RETURN
decd:
SELECT
WHEN c<MT-2 THEN CALL cons
WHEN c>=MT-2 THEN CALL slout
OTHERWISE NOP
END
RETURN
slin:
FPX=FPX+Line.cnt
cnt=cnt-1
RETURN
cons:
FPX=FPX+SM
RETURN
slout:
FPX=FPX+CD
CD=TRUNC((CD/2)+0.5)
IF CD<0 THEN CD=0
ENDIF
IF CD>SM THEN CD=SM
ENDIF
RETURN
err:
/* Create an error message for external program */
flgb=1
mess="Slowing must be more than 1 frame"
RETURN
err2:
/* Create an error message for external program */
flgb=1
mess="Cannot move less than 1 pixel per frame"
RETURN
err3:
/* Create an error message for external program */
flga=1
mess="Unable to open text file in RAM for output"
RETURN
moveadj:
/* Create a message for use in main program. The message
Has been created in seperate lines to better fit any kind
of requester */
flg=1
AdjMess.=""
AdjMess.1=" Because the distance is greater than "
AdjMess.2=" the frames some frames need to be duplicated."
AdjMess.3=" Would you like to adjust the image size to "
AdjMess.4=" compensate? "
Return /* Get a signal from main program */
Contsg:
/* process the signal and do accordingly */
IF sg=1 THEN CALL slowmain
ENDIF
percCa=TRUNC((fr/fd)+0.5)
A=(A+percC)+percC
R=TRUNC((A/percA)+0.5) /* Total distance for slowin */
U=TRUNC((A/percB)+0.5) /* Total distance for slowout */
fd=fr-A
sz=(fr/fd)+100 /* percent to Scale image when more pixels are needed */
Return